Editing mathematics

Amaya allows you to include mathematical expressions in web pages, following the Mathematical Markup Language (MathML) specification. Mathematical expressions are handled as structured components, exactly in the same way as HTML elements. Therefore, you can manipulate math expressions in the same way you manipulate other parts of HTML documents. All editing commands provided by Amaya for handling text are also available for math, and there are some additional controls to enter mathematical constructs.

Warning: In the current version of Amaya only a subset of MathML is implemented. The purpose of this alpha version of the math extension is to show how MathML may improve scientific communication over the Web. A more complete and more robust implementation is planed for future releases.

Creating a math expression

The Math palette and the Types/Math menu

To create a mathematical expression in a document, just move the insertion point (the caret) to the position where you want to insert that expression, and click the Math button (the rightmost button), or select the last entry (Math) from the Types menu. The Math button displays a palette that stays on the screen, the Types menu displays a popup menu. Just choose the most convenient tool. Both allow you to select the mathematical construct to be inserted.

In this palette or in the menu the first two items allow you to create a new formula, when the caret is in some HTML element (but the caret should not be within a MathML element):

The next items of the Math menu (or palette) allow you to create new constructs within a formula. If the caret is not in a formula, a Math element is created to accept the new construct. In this version of Amaya, the available constructs are, from top to bottom:

The last item of the Math palette ( αβγ ) displays another palette from which you can insert symbols and greek characters in mathematical expressions.

Entering constructs from the keyboard

You are not obliged to use a menu or a palette to create and edit mathematical expressions. You can enter mathematical constructs directly from the keyboard, as each item in the Math menu has a keyboard equivalent (see the menu itself). This allows you to type faster. To type even faster, you may also use the keyboard to move the caret from a construct to another, with the arrow keys.

Entering characters

When you type a character string in a MathML element, Amaya parses that string and generates the MO (operator), MN (number), MI (identifier), MTEXT elements automatically. For instance, to enter

x = 2 a + b

just type x=2a+b, (don't forget to first click on the Math or MathDisp item of the Math menu, if you are not in a mathematical expression) and you will get the following structure (you can check in the Math_Structure view):

<MI>x</MI><MO>=</MO><MN>2</MN><MI>a</MI><MO>+</MO><MI>b</MI>

Structure editing

You may want to change the structure of an existing expression, e.g. appending a superscript or puting parentheses around an expression. To do that, select the expression and enter the new construct with the palette, the Math menu or the keyboard.

You can also use the Transform command from the Special menu. Select the expression you want to transform and the Transform command will display a menu with all possible changes.

Math_Structure view

Whenever a document contains some MathML elements, choosing the Show Structure item from the Views menu actually opens two views:

You can edit math expressions either in the main view or in the Math_Structure view. The Math_Structure view is especially helpful to avoid ambiguity. Consider the following example:

x = a + b + 1

When moving the caret after character b, it is not clear whether you want to add something within the square root or after it. Selecting (or checking) in the Math_Structure view avoids any ambiguity.

Current limitations

The current version of Amaya only implements the Presentation Tags from MathML, not the Content Markup. All presentation elements are available, except tables and matrices (MTABLE, MTR, MTD). MathML attributes are not implemented (except fontslant which is available in the Attributes menu when a MI element is selected), but the class and style attributes from HTML are available: you can associate CSS style with MathML elements.